<!DOCTYPE html>
<html lang="en" xmlns:layout="http://www.w3.org/1999/xhtml"
      layout:decorate="~{admin/adminJs}" xmlns:v-on="http://www.w3.org/1999/xhtml">

<body layout:fragment="content">
<!--搜索栏-->
<div id="toolbar">
    <div id="search" style="padding:15px">

    </div>
    <div id="operator" style="padding:0 0 15px 15px">
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" v-on:click="add('')">新增</a>
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit'" v-on:click="edit()">修改</a>
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" v-on:click="deleted()">删除</a>
    </div>
</div>
<!--列表-->
<table id="table" style="width:100%;" >

</table>

<script>

    var typeKey=RequestUtils.get("typeKey");
    var filter={ typeKey:typeKey };

    function reload(){
        $('#table').datagrid('reload',filter);
    }

    function closeDialog(isRefresh) {
        if(isRefresh){
            reload();
        }
        $('#editDialog').dialog("close");
    }


    var vm=  new Vue({
        el: '#toolbar',
        data:filter,
        methods: {
            query:function () {
                reload();
            },
            add:function (id) {
                EasyuiUtils.openWindows("editDialog",'新增',660,500,'/admin/system/dictionary/entity/edit?id='+id+"&typeKey="+this.typeKey);
            },
            edit:function () {
                var row=EasyuiUtils.getSelected("#table");
                if(row){
                    this.add(row.id);
                }
            },
            deleted:function () {
                EasyuiUtils.confirmDelete("#table",'/admin/system/dictionary/entity/delete');
            }
        }
    });

    $('#table').datagrid({
        url:'/admin/system/dictionary/entity/listData',
        queryParams:filter,
        columns:[
            [
                {field:'id',title:'id',align:'center',width:'10%',checkbox:true},
                {field:'dictKey',title:'字典键',align:'center',width:'20%',hidden:false},
                {field:'value',title:'字典值',align:'center',width:'10%'},
                {field:'sortNo',title:'排序',align:'center',width:'10%',hidden:false},
                {field:'typeKey',title:'字典代码',align:'center',width:'10%',hidden:false},
                {field:'description',title:'描述',align:'center',width:'30%',hidden:false},
                {field:'createTime',title:'创建时间',align:'center',width:'18%',hidden:false},
                {field:'creator',title:'',align:'center',width:'10%',hidden:true},
                {field:'updatedby',title:'',align:'center',width:'10%',hidden:true},
                {field:'updateTime',title:'',align:'center',width:'10%',hidden:true},
                {field:'isDeleted',title:'',align:'center',width:'10%',hidden:true}
            ]
        ],
        striped:true,
        pagination:true,
        rownumbers:true,
        singleSelect:true,
        toolbar:'#toolbar'
    });

</script>
</body>

</html>